package com.aurora.source.source.viewmodel;

import android.app.Application;
import android.databinding.ObservableField;
import android.support.annotation.NonNull;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

/**
 * @author: ww
 * @description:
 * @date: 2018/12/6
 */
public class LoginViewModel extends BaseViewModel{

    public ObservableField<String> userName = new ObservableField<>();
    public ObservableField<Boolean> isRememb = new ObservableField<>(true);

    public BindingCommand loginOnClickCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            login();
        }
    });

   public void initUI(){
       userName.set("初始化账号");
      // isRememb.addOnPropertyChangedCallback();
   }

    private void login() {
        ToastUtils.showShort(userName.get());
        isRememb.set(!isRememb.get());
    }

    public LoginViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }
}
